package com.kaoshi.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kaoshi.entity.Team;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author author
 * @since 2024-10-29
 */
public interface TeamMapper extends BaseMapper<Team> {

    @Select("<script>"
            +"select t.*,i.organization jigou from team t left join institution i on t.iid=i.id where t.lj=1 and t.did=#{i} "
            +"<if test='t1.iid!=null'> and t.iid=#{t1.iid} </if>"
            +"<if test='t1.teamname!=null and t1.teamname!=\"\"'> and t.teamname like '%${t1.teamname}%'</if>"
            +"</script>")
    Page<Team> findpage(Page<Team> page,@Param("t1") Team team,@Param("i") Integer id,@Param("n") String name);


    @Select("<script>"
            +"select t.*,i.organization jigou from team t left join institution i on t.iid=i.id left join t_d on t_d.tid=t.id where t_d.did=#{i} and t_d.tz=0 and t_d.del=1 "
            +"<if test='t1.iid!=null'> and t.iid=#{t1.iid} </if>"
            +"<if test='t1.teamname!=null and t1.teamname!=\"\"'> and t.teamname like '%${t1.teamname}%'</if>"
            +"</script>")
    Page<Team> findpage1(Page<Team> page,@Param("t1") Team team,@Param("i") Integer id);
}
